package com.hudson.plugin.result.collector.server.datastore.dao;

import com.hudson.plugin.result.collector.server.datastore.dao.exceptions.IllegalOrphanException;
import com.hudson.plugin.result.collector.server.datastore.dao.exceptions.NonexistentEntityException;
import com.hudson.plugin.result.collector.server.datastore.dao.exceptions.PreexistingEntityException;
import com.hudson.plugin.result.collector.server.datastore.internal.entity.BuildsEntity;
import com.hudson.plugin.result.collector.server.datastore.internal.entity.ProjectsEntity;

import javax.persistence.EntityManager;
import java.util.List;

/**
 * Created by IntelliJ IDEA.
 * User: Richard
 * Date: 4/19/11
 * Time: 12:18 AM
 * To change this template use File | Settings | File Templates.
 */
public interface BuildsEntityJpaController {
    EntityManager getEntityManager();

    void create(BuildsEntity buildsEntity) throws PreexistingEntityException, Exception;

    void edit(BuildsEntity buildsEntity) throws IllegalOrphanException, NonexistentEntityException, Exception;

    void destroy(int id) throws IllegalOrphanException, NonexistentEntityException;

    BuildsEntity findBuildsEntity(int id);

    List<String> findProjectAllBuildsNumber(ProjectsEntity projectsEntity);

    List<Integer> findBuildsByProjectIdAndBuildNumber(Integer projectId, String buildNum);
}
